# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=py_stringmatching
pkgname=python-${_pkg}
pkgver=0.4.3
pkgrel=2
pkgdesc="Comprehensive and scalable set of string tokenizers and similarity measures"
arch=(loong64 x86_64)
url="https://github.com/anhaidgroup/py_stringmatching"
license=(BSD)
depends=(python-numpy python-six)
makedepends=(python-setuptools cython)
checkdepends=(python-nose)
source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
#source=(https://github.com/anhaidgroup/py_stringmatching/archive/v${pkgver}/${_pkg}-${pkgver}.tar.gz)
sha256sums=('921b9bb163b310df341c33823913204f7b0ca9f6a319f5b451408300bd378dee')

build() {
  cd ${_pkg}-${pkgver}
  sed -i 's|if not PIP_INSTALLED:|if False:|g' setup.py
  python setup.py build
}

# `No module named 'py_stringmatching.similarity_measure.cython.cython_affine'` even with PYTHONPATH
#check() {
#  cd ${_pkg}-${pkgver}
#  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
#  PYTHONPATH="${PWD}"/build/lib.linux-${CARCH}-${python_version} nosetests
#}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}
}
